﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Specification
{
    public abstract class Conjunction<T> : CompositeSpecification<T>
    {
        public Conjunction()
        {
            this._Specifications = new List<ISpecification<T>>();
        }
        public Conjunction(IEnumerable<ISpecification<T>> Specifications)
        {
            this._Specifications = Specifications;
        }
        public override bool isSatisfiedBy(T objekt)
        {
            foreach (ISpecification<T> specification in this._Specifications)
            {
                if (!specification.isSatisfiedBy(objekt))
                    return false;
            }
            return true;
        }
    }
}